import request from '../../api'

const userInf = {
  namespaced: true,
  state: {
    // 用户个人信息
    userInfo: {}
  },
  mutations: {
    getUserInfo(state: any, payload: any) {
      state.userInfo = payload.data
    }
  },
  actions: {
    // 获取用户数据
    getUserInfo({ commit }: any, payload: any) {
      request.userInf.getUserInf({ userId: payload.data }).then((res: any) => {
        commit('getUserInfo', { data: res.data })
      })
    }
  }
}

export default userInf
